// SmartCleanUp.h: interface for the CSmartCleanUp class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SMARTCLEANUP_H__D98D37D2_7B7B_47E8_8DA2_D170A1250596__INCLUDED_)
#define AFX_SMARTCLEANUP_H__D98D37D2_7B7B_47E8_8DA2_D170A1250596__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

template<class T>
class CSmartCleanUp  
{
public:
	CSmartCleanUp()
		:m_pObject(NULL)
	{
	};

	explicit CSmartCleanUp(T* pObject) // to avoid the implicit conversions [7/31/2007 Pseudonym]
		:m_pObject(pObject)
	{
	};

	~CSmartCleanUp()
	{
		delete m_pObject;
		m_pObject = NULL;
	};


	inline void SetObject(T* pObject)
	{
		m_pObject = pObject;
	};

	inline T* GetObject()
	{
		return m_pObject;
	};

protected:
	T* m_pObject;
};

#endif // !defined(AFX_SMARTCLEANUP_H__D98D37D2_7B7B_47E8_8DA2_D170A1250596__INCLUDED_)
